#include "./math_test.h"

TEST(Mathematics, Max_int_int_1) {

	// Arrange
	int value1 = 2, final_value1 = 2;
	int value2 = 1, final_value2 = 1;

	int expected = 2;

	// Act
	int actual = Max( value1, value2 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( value2, final_value2 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Max_double_double_2) {

	// Arrange
	double value1 = -1.0, final_value1 = -1.0;
	double value2 = 2.0, final_value2 = 2.0;

	double expected = 2.0;

	// Act
	double actual = Max( value1, value2 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( value2, final_value2 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Min_double_double_1) {

	// Arrange
	double value1 = 1.0, final_value1 = 1.0;
	double value2 = -2.0, final_value2 = -2.0;

	double expected = -2.0;

	// Act
	double actual = Min( value1, value2 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( value2, final_value2 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Min_int_int_2) {

	// Arrange
	int value1 = 1, final_value1 = 1;
	int value2 = 2, final_value2 = 2;

	int expected = 1;

	// Act
	int actual = Min( value1, value2 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( value2, final_value2 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Signal_double_1) {

	// Arrange
	double value1 = 1.0, final_value1 = 1.0;

	double expected = 1.0;

	// Act
	double actual = Signal( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Signal_int_2) {

	// Arrange
	int value1 = 0, final_value1 = 0;

	int expected = 0;

	// Act
	int actual = Signal( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Signal_double_3) {

	// Arrange
	double value1 = -2.5, final_value1 = -2.5;

	double expected = -1.0;

	// Act
	double actual = Signal( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Mod_double_1) {

	// Arrange
	double value1 = 2.0, final_value1 = 2.0;

	double expected = 2.0;

	// Act
	double actual = Mod( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Mod_int_2) {

	// Arrange
	int value1 = -2, final_value1 = -2;

	int expected = 2;

	// Act
	int actual = Mod( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Round_double_1) {

	// Arrange
	double value1 = 2.1, final_value1 = 2.1;

	int expected = 2;

	// Act
	int actual = Round( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Round_double_2) {

	// Arrange
	double value1 = 2.9, final_value1 = 2.9;

	int expected = 3;

	// Act
	int actual = Round( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Round_double_3) {

	// Arrange
	double value1 = 2.5, final_value1 = 2.5;

	int expected = 3;

	// Act
	int actual = Round( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Round_double_4) {

	// Arrange
	double value1 = -2.1, final_value1 = -2.1;

	int expected = -2;

	// Act
	int actual = Round( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Round_double_5) {

	// Arrange
	double value1 = -2.9, final_value1 = -2.9;

	int expected = -3;

	// Act
	int actual = Round( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Round_double_6) {

	// Arrange
	double value1 = -2.5, final_value1 = -2.5;

	int expected = -3;

	// Act
	int actual = Round( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Fract_double_1) {

	// Arrange
	double value1 = 2.1, final_value1 = 2.1;

	double expected = 0.1;

	// Act
	double actual = Fract( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_NEAR( expected, actual, 0.001 );

};

TEST(Mathematics, Fract_double_2) {

	// Arrange
	double value1 = 2.9, final_value1 = 2.9;

	double expected = 0.9;

	// Act
	double actual = Fract( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_NEAR( expected, actual, 0.001 );

};

TEST(Mathematics, Fract_double_3) {

	// Arrange
	double value1 = -2.1, final_value1 = -2.1;

	double expected = -0.1;

	// Act
	double actual = Fract( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_NEAR( expected, actual, 0.001 );

};

TEST(Mathematics, Fract_double_4) {

	// Arrange
	double value1 = -2.8, final_value1 = -2.8;

	double expected = -0.8;

	// Act
	double actual = Fract( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_NEAR( expected, actual, 0.001 );

};

TEST(Mathematics, Low_double_1) {

	// Arrange
	double value1 = 2.1, final_value1 = 2.1;

	int expected = 2;

	// Act
	int actual = Low( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Low_double_2) {

	// Arrange
	double value1 = 2.9, final_value1 = 2.9;

	int expected = 2;

	// Act
	int actual = Low( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Low_double_3) {

	// Arrange
	double value1 = -2.1, final_value1 = -2.1;

	int expected = -3;

	// Act
	int actual = Low( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Low_double_4) {

	// Arrange
	double value1 = -2.7, final_value1 = -2.7;

	int expected = -3;

	// Act
	int actual = Low( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Upp_double_1) {

	// Arrange
	double value1 = 2.2, final_value1 = 2.2;

	int expected = 3;

	// Act
	int actual = Upp( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Upp_double_2) {

	// Arrange
	double value1 = 2.8, final_value1 = 2.8;

	int expected = 3;

	// Act
	int actual = Upp( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Upp_double_3) {

	// Arrange
	double value1 = -2.2, final_value1 = -2.2;

	int expected = -2;

	// Act
	int actual = Upp( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Upp_double_4) {

	// Arrange
	double value1 = -2.75, final_value1 = -2.75;

	int expected = -2;

	// Act
	int actual = Upp( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Near_double_1) {

	// Arrange
	double value1 = 2.25, final_value1 = 2.25;

	int expected = 2;

	// Act
	int actual = Near( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Near_double_2) {

	// Arrange
	double value1 = 2.75, final_value1 = 2.75;

	int expected = 2;

	// Act
	int actual = Near( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Near_double_3) {

	// Arrange
	double value1 = -2.25, final_value1 = -2.25;

	int expected = -2;

	// Act
	int actual = Near( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Near_double_4) {

	// Arrange
	double value1 = -2.75, final_value1 = -2.75;

	int expected = -2;

	// Act
	int actual = Near( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Far_double_1) {

	// Arrange
	double value1 = 2.25, final_value1 = 2.25;

	int expected = 3;

	// Act
	int actual = Far( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Far_double_2) {

	// Arrange
	double value1 = 2.75, final_value1 = 2.75;

	int expected = 3;

	// Act
	int actual = Far( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Far_double_3) {

	// Arrange
	double value1 = -2.75, final_value1 = -2.75;

	int expected = -3;

	// Act
	int actual = Far( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

TEST(Mathematics, Far_double_4) {

	// Arrange
	double value1 = -2.3, final_value1 = -2.3;

	int expected = -3;

	// Act
	int actual = Far( value1 );

	// Assert
	EXPECT_EQ( value1, final_value1 );
	EXPECT_EQ( expected, actual );

};

